package com.shudes.game;

import java.util.*;

import com.shudes.util.*;

public class Suit extends EnumeratedType {

	public static final Suit CLUB = new Suit(1L,"c"); 
	public static final Suit DIAMOND = new Suit(2L, "d"); 
	public static final Suit HEART = new Suit(3L, "h"); 
	public static final Suit SPADE = new Suit(4L, "s"); 

	protected static Map<Long, Suit> idMap;
	protected static Map<String, Suit> descriptionMap;
	
	public Suit(Long id, String description) {
		super(id, description);

		if(Suit.idMap==null)  
			Suit.idMap = new HashMap<Long, Suit>(); 
		
		if(Suit.descriptionMap==null) 
			Suit.descriptionMap = new HashMap<String, Suit>(); 

		idMap.put(id, this); 
		descriptionMap.put(description, this); 
	}
	
	public static Suit byId(Long id) { 
		return idMap.get(id);
	}
	
	public static Suit byName(String name) { 
		return descriptionMap.get(name); 
	}

	public static Set<Suit> getAll() { 
		return new HashSet<Suit>(idMap.values());
	}
	

}
